// 自定义封装消息提示框

const msgTip = ({title='处理成功...', icon="none", duration=2000, mask=true} = options) =>{
  wx.showToast({
    title,
    icon,
    duration,
    mask
  })
}

// 封装弹出层的提示框
const msgTipAlert = (options = {}) =>{
  let defalutOptions = {
    title: '提示',
    content: '是否确认进行操作？',
    confirmColor: '#f3514f',
  }
  let opts = Object.assign({},defalutOptions, options);
  return new Promise((resolve) =>{

    wx.showModal({
      ...opts,
      complete: ({cancel,confirm}) => {
        cancel &&  resolve(false)
        confirm && resolve(true)
      }
    })
  })

}

wx.msgTipAlert = msgTipAlert

export{msgTip, msgTipAlert}